import React,{ Component } from "react";

export default function Hello() {
    function fn() {
        console.log("函数组件1", this);  // undefined
    }

    function fn2(n) {
        console.log(n, this)  // undefined
    }

    return (
        <div>
            <button onClick={fn.bind(this)}>事件</button>
            <button onClick={() => {fn2(20)}}>事件传参</button>
        </div>
    )
}